package com.javasm.sys.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.javasm.commons.entity.LoginQuery;
import com.javasm.sys.SysLoginLogService;
import com.javasm.sys.dao.SysLoginLogMapper;
import com.javasm.sys.SysLoginLog;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class SysLoginLogServiceImpl implements SysLoginLogService {

    @Resource
    private SysLoginLogMapper sysLoginLogMapper;

    @Override
    public int deleteByPrimaryKey(Long infoId) {
        return sysLoginLogMapper.deleteByPrimaryKey(infoId);
    }

    @Override
    public int insert(SysLoginLog record) {
        return sysLoginLogMapper.insert(record);
    }

    @Override
    public int insertSelective(SysLoginLog record) {
        return sysLoginLogMapper.insertSelective(record);
    }

    @Override
    public SysLoginLog selectByPrimaryKey(Long infoId) {
        return sysLoginLogMapper.selectByPrimaryKey(infoId);
    }

    @Override
    public int updateByPrimaryKeySelective(SysLoginLog record) {
        return sysLoginLogMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SysLoginLog record) {
        return sysLoginLogMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo getLoginInfo(LoginQuery loginQuery, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<SysLoginLog> sysLoginLogList = sysLoginLogMapper.getLoginLog(loginQuery);
        PageInfo<SysLoginLog> pageInfo = new PageInfo<>(sysLoginLogList);
        return pageInfo;
    }

    @Override
    public List<SysLoginLog> selectAll() {
        return  sysLoginLogMapper.selectAll();
    }

    @Override
    public void batchDeleteLog(Integer[] ids) {
        sysLoginLogMapper.batchDeleteLog(ids);
    }

}
